//    Copyright (C) Kherty.  All rights reserved.
using System;
using OpenLS.Core.Serialization;

namespace OpenLS.Drawing.Media
{
    public abstract class MediaObject: IOfficeXmlSerializable
    {
        public abstract void ReadXml(ReadContext context);
        public abstract void WriteXml(WriteContext context);

        internal static MediaObject ReadOptionalMedia(ReadContext context)
        {
            switch (context.ReaderLocalName)
            {
                case VideoFile.xmlName:
                    return context.ReadElement<VideoFile>();
                case AudioFile.xmlName:
                    return context.ReadElement<AudioFile>();
                case EmbeddedWavAudioFile.xmlName:
                    return context.ReadElement<EmbeddedWavAudioFile>();
                    case QuickTimeFile.xmlName:
                    return context.ReadElement<QuickTimeFile>();
                case AudioCD.xmlName:
                    return context.ReadElement<AudioCD>();
                default:
                    return null;
            }
        }
    }
}